<template>
	<div>
		
		<span>
			<el-upload class="upload-demo" ref="upload" drag action="http://localhost:8082/video/upload" multiple :auto-upload="false"
			 :limit="5" :data="uploadData" :on-success="handleFilUploadSuccess"  :on-remove="handleRemove">
				<i class="el-icon-upload"></i>
				<div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
				<div class="el-upload__tip" slot="tip">只能上传 MP4文件，且不超过500MB</div>
			</el-upload>
		</span>
		<span slot="footer" class="dialog-footer">
			<el-button @click="dialogVisible = false">取 消</el-button>
			<el-button type="primary" @click="handleUpload">确 定</el-button>
		</span>
	</div>
</template>

<script>

export default {
	name: '',
	props: ['editid'],
	data() {
		return {
			uploadData:{
				id:""
			}
		};
	},
	components: {
	},
	created() {
		if (this.editid) {
			this.uploadData.id=this.editid
		}
	},
	methods: {
		handleRemove(file, fileList) {
			console.log(file, fileList);
		},
		submitUpload() {
			this.$refs.upload.submit();
		},
		// 文件上传成功时的函数
		handleFilUploadSuccess(res, file, fileList) {
			
			this.$message.success("上传成功")
			this.$emit("getData()")
		},
		handleUpdate() {},
		// 处理文件上传的函数
		handleUpload() {
			
			this.submitUpload()
		}
	}
};
</script>
<style scoped>
	.btn-upload {
		top: 70px;
		right: 40px;
		position: fixed;
		z-index: 100;
		border-radius: 30px;
		box-shadow: 0 2px 12px 0 rgba(91, 156, 255, 0.9)
	}
	
	.el-upload {
		margin: 5px;
	}
</style>
